﻿using MediatR;
using RBAC.LuFang.API.Application.Command.slaughterCommand;
using RBAC.LuFang.Domain.Traceability;
using RBAC.LuFang.Domin.Services.TraceabilityService;

namespace RBAC.LuFang.API.Application.CommandHandlers.slaughterCommandHandler
{
    //更新屠宰信息
    public class slaughterUpdCommandHandler:IRequestHandler<slaughterUpdCommand,int>
    {
        private readonly IslaughterService _slaService;

        public slaughterUpdCommandHandler(IslaughterService slaService)
        {
            _slaService = slaService;
        }

        public async Task<int> Handle(slaughterUpdCommand request, CancellationToken cancellationToken)
        {
            var slaModel = new slaughter() { slaughterid=request.slaughterid, slaughterPici=request.slaughterPici, slaughterZhong=request.slaughterZhong, slaughterKdate=request.slaughterKdate, slaughterDate=request.slaughterDate, goodsId=request.goodsId };
            return await _slaService.Updslaughter(slaModel);
        }
    }
}
